﻿Imports System.Data.OleDb
Public Class fooddetail
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged

    End Sub

    Protected Sub cmdcomment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdcomment.Click
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim SqlString As String = "Insert into comment2(title, comments, dish_fkid, author) Values (@f1,@f2,@f3, @f4)"

        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", txtitle.Text)
        cmd.Parameters.AddWithValue("@f2", txtcomment.Text)
        cmd.Parameters.AddWithValue("@f3", Request.Params("ID"))
        cmd.Parameters.AddWithValue("@f4", User.Identity.Name)

        oleDbConn.Open()
        cmd.ExecuteNonQuery()

        txtitle.Text = ""
        txtcomment.Text = ""

        Response.Redirect("confirmation.aspx")
    End Sub
End Class